<?php
$countNews = count($listNews);
if($countNews > 0){
    for($i=0; $i<$countNews; $i++){
?>
    <div class="post_item">
        <div class="title_home"><a href="<?php echo "/pages/" . $listNews[$i]->news_id; ?>"><?php echo $listNews[$i]->news_title; ?></a></div>
        <div class="post_header">
            <img src="<?php echo base_url() ?>static/images/icon/clock-icon.png" /> <?php echo $listNews[$i]->publish_date; ?>
            <img src="<?php echo base_url() ?>static/images/icon/label-icon.png" class="label" />
            <?php
            $tag = $listNews[$i]->news_tag;
            $arrTag = explode(",", $tag);
            $html = "";
            for($j=0; $j<count($arrTag)-1; $j++){
                $html .= "<a href='/tag/" . trim($arrTag[$j]) . "'>" . trim($arrTag[$j]) . "</a> , ";
            }
            $html .= "<a href='/tag/" . trim($arrTag[count($arrTag)-1]) . "'>" . trim($arrTag[count($arrTag)-1]) . "</a>";
            echo $html;
            ?>
        </div>
        <div class="post_body">
            <?php
            $image = ($listNews[$i]->image_thumb == "" || $listNews[$i]->image_thumb == null) ? "http://lamsaopro.com/static/upload/No-image.png" : $listNews[$i]->image_thumb;
            ?>
            <img src="<?php echo $image; ?>" />
            <div class="short_desc">
                <?php echo $listNews[$i]->short_desc; ?>
            </div>
            <div class="clear_float"></div>
            <div class="read_more">
                <a href="<?php echo "/pages/" . $listNews[$i]->news_id; ?>">XEM THÊM</a>
            </div>
        </div>
    </div>
    <?php
    } 
    ?>

<div class="paging">
    <?php echo $paging; ?>
</div>
<?php
}
else{
?>
<div class="post_item" style="text-align:center">
    Không có bài viết
</div>
<?php
}
?>